<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="jquery-3.4.1.min.js"></script>
    <script src="echarts.js"></script>
    <title>Document</title>
</head>
<body>
    
    <div id="echarts" style="width: 100%; height: 480px;"></div>


    <script>
        function getData(yes, no) {
            var dom = document.getElementById("echarts");
            var myChart = echarts.init(dom);
            option = {
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b} : {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: ['有重复违章','无重复违章']
                },
                series: [
                    {
                        name: '有无重复违章占比',
                        type: 'pie',
                        radius: '55%',
                        center: ['50%', '50%'],
                        data: [
                            {value: yes, name: '有重复违章'},
                            {value: no, name: '无重复违章'}
                        ],
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            if (option && typeof option === "object") {
                myChart.setOption(option, true);
            }
        }
    </script>
</body>
</html>